package com.tanhua.server.service;

import com.tanhua.dubbo.api.UserApi;
import com.tanhua.model.domain.User;
import com.tanhua.model.vo.HuanXinUserVo;
import com.tanhua.server.interceptor.UserHolder;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.stereotype.Service;

@Service
public class HuanXinService {

    @DubboReference
    private UserApi userApi;

    /**
     * 获取环信用户名和密码
     * @return
     */
    public HuanXinUserVo findByHuanXin() {
        User user = userApi.findById(UserHolder.getUserId());

        HuanXinUserVo vo = new HuanXinUserVo();

        vo.setUsername(user.getHxUser());
        vo.setPassword(user.getHxPassword());

        return vo;
    }
}
